package cn.aylog.controller;

import cn.aylog.po.User;
import com.alibaba.fastjson.JSONArray;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

@RestController
public class SomeController {

    @RequestMapping("/value")
    public String getValue() {
        List<User> list = new ArrayList<>();

        for(int i=1; i<=5; i++) {
            User o = new User();
            o.setAge(i + 20);
            o.setName("aylog" + i);
            list.add(o);
        }
        String jsonString = JSONArray.toJSONString(list);
        return jsonString;
    }

}
